home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / include / incl98.zoo / limits.h < prev    next >
C/C++ Source or Header  |  1993-11-17  |  3KB  |  131 lines

  1. /*
  2.  *    LIMITS.H
  3.  *    see ansi draft sec 4.1.3 and 2.2.4.2
  4.  */
  5.  
  6. #ifndef    _LIMITS_H
  7. #define    _LIMITS_H
  8.  
  9. #ifndef _COMPILER_H
  10. #include <compiler.h>
  11. #endif
  12.  
  13. #ifndef __MINT__
  14. #define    PATHSIZE    (128)        /* maximum pathname length */
  15. #define    BITSPERBYTE    8
  16. #endif
  17.  
  18.  
  19. #define CHAR_BIT 8
  20.  
  21. #define SCHAR_MAX 127
  22. #define SCHAR_MIN (-128)
  23. #define UCHAR_MAX 255
  24.  
  25. #ifdef __CHAR_UNSIGNED__
  26. #define CHAR_MAX UCHAR_MAX
  27. #define CHAR_MIN 0
  28. #else
  29. #define CHAR_MAX SCHAR_MAX
  30. #define CHAR_MIN SCHAR_MIN
  31. #endif
  32.  
  33. #define SHRT_MAX 32767
  34. #define SHRT_MIN (-32768)
  35. #define LONG_MAX 2147483647L
  36. #define LONG_MIN (-LONG_MAX-1) /* this fixes the float cast problem ! */
  37. #define USHRT_MAX 65535U
  38. #define ULONG_MAX 4294967295UL
  39.  
  40. #ifdef __MSHORT__ /* 16 bit ints */
  41. #define INT_MAX SHRT_MAX
  42. #define INT_MIN SHRT_MIN
  43. #define UINT_MAX USHRT_MAX
  44.  
  45. #else /* 32 bit ints */
  46.  
  47. #define INT_MAX 2147483647
  48. #define INT_MIN (-INT_MAX-1) /* this fixes the float cast problem ! */
  49. #define UINT_MAX 4294967295U
  50.  
  51. #endif /* __MSHORT__ */
  52.  
  53. #if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(_POSIX_SOURCE)
  54. /* Minimum and maximum values a `signed long long int' can hold.  */
  55. #define LONG_LONG_MAX 9223372036854775807LL
  56. #define LONG_LONG_MIN (-LONG_LONG_MAX-1)
  57.  
  58. /* Maximum value an `unsigned long long int' can hold.  (Minimum is 0).  */
  59. #define ULONG_LONG_MAX 18446744073709551615ULL
  60.  
  61. #endif /* __GNUC__ && !__STRICT_ANSI__ && !_POSIX_SOURCE*/
  62.   
  63. #define MB_LEN_MAX    1    /* max. number of bytes in a multibyte character */
  64.  
  65. /*
  66.  * POSIX-specific stuff; see 1003.1 sect. 2.9
  67.  *
  68.  * Note that the library is *not* POSIX compliant; hence
  69.  * the illegally small values for some constants (e.g. _POSIX_LINK_MAX)
  70.  */
  71.  
  72. #define _POSIX_ARG_MAX        32767    /* Actually limited by memory */
  73. #define _POSIX_CHILD_MAX    16    /* Actually limited by memory */
  74. #define _POSIX_LINK_MAX        32767
  75. #define _POSIX_MAX_CANON    64    /* <- NON-CONFORMING */
  76. #define _POSIX_MAX_INPUT    64    /* <- NON-CONFORMING */
  77. #define _POSIX_NAME_MAX        31    /* <- arbitrary */
  78. #define _POSIX_NGROUPS_MAX    512    /* <- arbitrary */
  79. #define _POSIX_OPEN_MAX        32
  80. #define _POSIX_PATH_MAX        128    /* <- NON-CONFORMING */
  81. #define _POSIX_PIPE_BUF        512
  82. #define _POSIX_STREAM_MAX    _NFILE
  83.  
  84. #ifndef __MINT__
  85. #undef  _POSIX_LINK_MAX
  86. #define _POSIX_LINK_MAX        1
  87. #undef  _POSIX_NGROUPS_MAX
  88. #define _POSIX_NGROUPS_MAX    0
  89. #endif /* __MINT__ */
  90.  
  91. #ifndef __STRICT_ANSI__
  92.  
  93. #ifndef STREAM_MAX
  94. #define STREAM_MAX        _NFILE
  95. #endif
  96. #define NGROUPS_MAX        _POSIX_NGROUPS_MAX
  97.  
  98. #if 0
  99. /* both of these are actually limited by available memory */
  100. #define ARG_MAX            32767
  101. #define CHILD_MAX        16
  102. #endif
  103.  
  104. #define OPEN_MAX        _POSIX_OPEN_MAX
  105. #define LINK_MAX        _POSIX_LINK_MAX
  106.  
  107. #define MAX_CANON        _POSIX_MAX_CANON
  108. #define MAX_INPUT        _POSIX_MAX_INPUT
  109. #define NAME_MAX        _POSIX_NAME_MAX
  110.  
  111. /* _LIB_NAME_MAX longest name supported in the library
  112.  *  before you change this, please look at stat.c, symdir.c, dirent.[ch],
  113.  *  unx2dos.c.
  114.  *  for the TOS library, this must be atleast 32 to maintain backwards
  115.  *  compatibility.
  116.  */
  117. #ifndef __MINT__
  118. #  define _LIB_NAME_MAX        32 /* CAUTION: dont make this any smaller */
  119. #else
  120. #  define _LIB_NAME_MAX        _POSIX_NAME_MAX
  121. #endif
  122.  
  123. #define PATH_MAX        _POSIX_PATH_MAX
  124. #define PIPE_BUF        _POSIX_PIPE_BUF
  125.  
  126. #define PASS_MAX        8
  127.  
  128. #endif /* __STRICT_ANSI__ */
  129.  
  130. #endif /* _LIMITS_H */
  131.